﻿using B.S.DataBase.MyProject.Domain.ArrivalCheck;
using B.S.DataBase.MyProject.Domain.Sales;
using B.S.DataBase.MyProject.Domain.ViewModels;
using B.S.DataBase.MyProject.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using T.E.ERP.Read.API.Applicantions.Command.CheckCommand;

namespace T.E.ERP.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CheckController : ControllerBase
    {
        private readonly IMediator mediator;
        public CheckController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 获取到货质检列表
        /// 物联网-智能MES生产管理系统-05-到货检验管理V1.1-20250206
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<View_ArrivalCheckList>>> GetArrivalCheckList([FromQuery] GetArrivalCheckListCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 根据采购入库单据Id获取该单据的所有物料列表
        /// 物联网-智能MES生产管理系统-05-到货检验管理V1.1-20250206
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<OrderMaterials>>> GetMaterailsListByPurCode([FromQuery] GetMaterailsListByPurCodeCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 获取质检记录
        /// 物联网-智能MES生产管理系统-05-到货检验管理V1.1-20250206
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIResult<List<CheckRecord>>> GetCheckRecordList([FromQuery] GetCheckRecordListCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
